
#ifndef ILI9341_LCD_H
#define ILI9341_LCD_H

#include <stdint.h>
#include <stdbool.h>

typedef struct {
    unsigned short width;
    unsigned short height;
    unsigned short id;
    unsigned char dir;
    unsigned short wramcmd;
    unsigned short setxcmd;
    unsigned short setycmd;
} _lcd_dev;


extern _lcd_dev lcddev;
#define USE_HORIZONTAL 1

#define LCD_W 240
#define LCD_H 320

extern unsigned short POINT_COLOR;
extern unsigned short BACK_COLOR;

#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define BRED 0XF81F
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define GREEN 0x07E0
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
#define BROWN 0XBC40
#define BRRED 0XFC07
#define GRAY 0X8430

#define DARKBLUE 0X01CF
#define LIGHTBLUE 0X7D7C
#define GRAYBLUE 0X5458

#define LIGHTGREEN 0X841F
#define LIGHTGRAY 0XEF5B
#define LGRAY 0XC618

#define LGRAYBLUE 0XA651
#define LBBLUE 0X2B12

void LCD_Init(void);
void LCD_DisplayOn(void);
void LCD_DisplayOff(void);
void LCD_Clear(unsigned short Color);	 
void LCD_SetCursor(unsigned short Xpos, unsigned short Ypos);
void LCD_DrawPoint(unsigned short x,unsigned short y);//����
void LCD_DrawLine(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2);
void LCD_DrawRectangle(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2);		   
void LCD_SetWindows(unsigned short xStar, unsigned short yStar,unsigned short xEnd,unsigned short yEnd);
void LCD_WriteReg(unsigned char LCD_Reg, unsigned short LCD_RegValue);
void LCD_WR_DATA(unsigned char data);
void LCD_WriteRAM_Prepare(void);
void LCD_WriteRAM(unsigned short RGB_Code);
void LCD_SetParam(void);
void Lcd_WriteData_16Bit(unsigned short Data);
void LCD_direction(unsigned char direction );
void LCD_WriteData_Array(uint8_t *data, uint32_t len);
#endif
